pub use self::texture1d::Texture1d;
pub mod texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture1d(TextureAny);
impl GlObject for Texture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture1d(self.0, Some(self.1))
}
}
impl Texture1d {
#[inline]
pub fn sampled(&self) -> Sampler<Texture1d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t Texture1d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl Texture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<Texture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<Texture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedFloatFormat, mipmaps: MipmapsOption)
-> Result<Texture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedFloatFormat>, mipmaps: MipmapsOption)
-> Result<Texture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyFloatingPoint);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(Texture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<Texture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| Texture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32) -> Result<Texture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| Texture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<Texture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| Texture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture1dMipmap> {
self.0.mipmap(level).map(|m| Texture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture1d);
impl<'a> ::std::ops::Deref for Texture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t Texture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture1dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_texture1d::CompressedTexture1d;
pub mod compressed_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedTexture1d(TextureAny);
impl GlObject for CompressedTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture1d(self.0, Some(self.1))
}
}
impl CompressedTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedTexture1d> {
Sampler(self, Default::default())
}
}
impl CompressedTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
Ok(CompressedTexture1d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressed, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressed);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, width: u32) -> Result<CompressedTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| CompressedTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture1dMipmap> {
self.0.mipmap(level).map(|m| CompressedTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedTexture1d);
impl<'a> ::std::ops::Deref for CompressedTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::srgb_texture1d::SrgbTexture1d;
pub mod srgb_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture1d(TextureAny);
impl GlObject for SrgbTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture1d(self.0, Some(self.1))
}
}
impl SrgbTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture1d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t SrgbTexture1d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl SrgbTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<SrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<SrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: SrgbFormat, mipmaps: MipmapsOption)
-> Result<SrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<SrgbFormat>, mipmaps: MipmapsOption)
-> Result<SrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnySrgb);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(SrgbTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<SrgbTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| SrgbTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32) -> Result<SrgbTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| SrgbTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<SrgbTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| SrgbTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture1dMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture1d);
impl<'a> ::std::ops::Deref for SrgbTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture1dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_texture1d::CompressedSrgbTexture1d;
pub mod compressed_srgb_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbTexture1d(TextureAny);
impl GlObject for CompressedSrgbTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture1d(self.0, Some(self.1))
}
}
impl CompressedSrgbTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbTexture1d> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedSrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
Ok(CompressedSrgbTexture1d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressedSrgb, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedSrgbFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressedSrgb);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedSrgbTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, width: u32) -> Result<CompressedSrgbTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| CompressedSrgbTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture1dMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbTexture1d);
impl<'a> ::std::ops::Deref for CompressedSrgbTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedSrgbFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::integral_texture1d::IntegralTexture1d;
pub mod integral_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture1d(TextureAny);
impl GlObject for IntegralTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture1d(self.0, Some(self.1))
}
}
impl IntegralTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture1d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t IntegralTexture1d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl IntegralTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<IntegralTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<IntegralTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedIntFormat, mipmaps: MipmapsOption)
-> Result<IntegralTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedIntFormat>, mipmaps: MipmapsOption)
-> Result<IntegralTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyIntegral);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(IntegralTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<IntegralTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| IntegralTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32) -> Result<IntegralTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| IntegralTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<IntegralTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| IntegralTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture1dMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture1d);
impl<'a> ::std::ops::Deref for IntegralTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture1dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture1d::UnsignedTexture1d;
pub mod unsigned_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture1d(TextureAny);
impl GlObject for UnsignedTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture1d(self.0, Some(self.1))
}
}
impl UnsignedTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture1d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t UnsignedTexture1d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl UnsignedTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<UnsignedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedUintFormat, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedUintFormat>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyUnsigned);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(UnsignedTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<UnsignedTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| UnsignedTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32) -> Result<UnsignedTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| UnsignedTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<UnsignedTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| UnsignedTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture1dMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture1d);
impl<'a> ::std::ops::Deref for UnsignedTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture1dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture1d::DepthTexture1d;
pub mod depth_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture1d(TextureAny);
impl GlObject for DepthTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture1d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture1d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture1d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture1d(self.0, Some(self.1))
}
}
impl DepthTexture1d {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture1d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for &'t DepthTexture1d {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthFormat, mipmaps: MipmapsOption)
-> Result<DepthTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthFormat>, mipmaps: MipmapsOption)
-> Result<DepthTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepth);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<DepthTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| DepthTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32) -> Result<DepthTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| DepthTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<DepthTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| DepthTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture1dMipmap> {
self.0.mipmap(level).map(|m| DepthTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture1d);
impl<'a> ::std::ops::Deref for DepthTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture1dMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture1d::StencilTexture1d;
pub mod stencil_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture1d(TextureAny);
impl GlObject for StencilTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for &'t StencilTexture1d {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl StencilTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<StencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<StencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: StencilFormat, mipmaps: MipmapsOption)
-> Result<StencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<StencilFormat>, mipmaps: MipmapsOption)
-> Result<StencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyStencil);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(StencilTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<StencilTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| StencilTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32) -> Result<StencilTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| StencilTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<StencilTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| StencilTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture1dMipmap> {
self.0.mipmap(level).map(|m| StencilTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture1d);
impl<'a> ::std::ops::Deref for StencilTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture1dMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture1d::DepthStencilTexture1d;
pub mod depth_stencil_texture1d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture1d(TextureAny);
impl GlObject for DepthStencilTexture1d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture1d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture1d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for &'t DepthStencilTexture1d {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthStencilTexture1d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthStencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthStencilFormat, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthStencilFormat>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1d, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepthStencil);
let RawImage1d { data, width, format: client_format } = data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthStencilTexture1d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1d { width: width }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32)
-> Result<DepthStencilTexture1d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1d { width: width }).map(|t| DepthStencilTexture1d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32) -> Result<DepthStencilTexture1d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width });
t.map(|t| DepthStencilTexture1d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32) -> Result<DepthStencilTexture1d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1d { width: width }).map(|t| DepthStencilTexture1d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture1d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture1d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture1dMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture1dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture1dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture1dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture1d);
impl<'a> ::std::ops::Deref for DepthStencilTexture1dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture1dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture1d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture1dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture1dMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture2d::Texture2d;
pub mod texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture2d(TextureAny);
impl GlObject for Texture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2d(self.0, Some(self.1))
}
}
impl Texture2d {
#[inline]
pub fn sampled(&self) -> Sampler<Texture2d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t Texture2d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl Texture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<Texture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<Texture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedFloatFormat, mipmaps: MipmapsOption)
-> Result<Texture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedFloatFormat>, mipmaps: MipmapsOption)
-> Result<Texture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyFloatingPoint);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(Texture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<Texture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| Texture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<Texture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| Texture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<Texture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| Texture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read<T>(&self) -> T where T: Texture2dDataSink<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read() }
}
#[inline]
pub fn read_to_pixel_buffer(&self) -> PixelBuffer<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read_to_pixel_buffer() }
}
#[inline]
pub unsafe fn unchecked_read<T, P>(&self) -> T where T: Texture2dDataSink<P>, P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
self.0.main_level().first_layer().into_image(None).unwrap().raw_read(&rect)
}
#[inline]
pub unsafe fn unchecked_read_to_pixel_buffer<P>(&self) -> PixelBuffer<P> where P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
let pb = PixelBuffer::new_empty(self.0.get_context(),
rect.width as usize * rect.height as usize);
self.0.main_level().first_layer().into_image(None).unwrap()
.raw_read_to_pixel_buffer(&rect, &pb);
pb
}
#[inline]
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
self.main_level().write(rect, data)
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dMipmap> {
self.0.mipmap(level).map(|m| Texture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture2d);
impl<'a> ::std::ops::Deref for Texture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let client_format = ClientFormatAny::ClientFormat(client_format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, true).unwrap()
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture2dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_texture2d::CompressedTexture2d;
pub mod compressed_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedTexture2d(TextureAny);
impl GlObject for CompressedTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture2d(self.0, Some(self.1))
}
}
impl CompressedTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedTexture2d> {
Sampler(self, Default::default())
}
}
impl CompressedTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32, height: u32,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
Ok(CompressedTexture2d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressed, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressed);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32) -> Result<CompressedTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| CompressedTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read<T>(&self) -> T where T: Texture2dDataSink<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read() }
}
#[inline]
pub fn read_to_pixel_buffer(&self) -> PixelBuffer<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read_to_pixel_buffer() }
}
#[inline]
pub unsafe fn unchecked_read<T, P>(&self) -> T where T: Texture2dDataSink<P>, P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
self.0.main_level().first_layer().into_image(None).unwrap().raw_read(&rect)
}
#[inline]
pub unsafe fn unchecked_read_to_pixel_buffer<P>(&self) -> PixelBuffer<P> where P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
let pb = PixelBuffer::new_empty(self.0.get_context(),
rect.width as usize * rect.height as usize);
self.0.main_level().first_layer().into_image(None).unwrap()
.raw_read_to_pixel_buffer(&rect, &pb);
pb
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
self.main_level().write(rect, data)
}
#[inline]
pub fn write_compressed_data(&self, rect: Rect, data: &[u8],
width: u32, height: u32, format: CompressedFormat)
-> Result<(), ()>
{
self.main_level().write_compressed_data(rect, data, width, height, format)
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture2dMipmap> {
self.0.mipmap(level).map(|m| CompressedTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedTexture2d);
impl<'a> ::std::ops::Deref for CompressedTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let client_format = ClientFormatAny::ClientFormat(client_format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, true).unwrap()
}
pub fn write_compressed_data(&self, rect: Rect, data: &[u8],
width: u32, height: u32, format: CompressedFormat)
-> Result<(), ()>
{
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, false)
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::srgb_texture2d::SrgbTexture2d;
pub mod srgb_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture2d(TextureAny);
impl GlObject for SrgbTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2d(self.0, Some(self.1))
}
}
impl SrgbTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture2d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t SrgbTexture2d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl SrgbTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<SrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<SrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: SrgbFormat, mipmaps: MipmapsOption)
-> Result<SrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<SrgbFormat>, mipmaps: MipmapsOption)
-> Result<SrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnySrgb);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(SrgbTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<SrgbTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| SrgbTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<SrgbTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| SrgbTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<SrgbTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| SrgbTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read<T>(&self) -> T where T: Texture2dDataSink<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read() }
}
#[inline]
pub fn read_to_pixel_buffer(&self) -> PixelBuffer<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read_to_pixel_buffer() }
}
#[inline]
pub unsafe fn unchecked_read<T, P>(&self) -> T where T: Texture2dDataSink<P>, P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
self.0.main_level().first_layer().into_image(None).unwrap().raw_read(&rect)
}
#[inline]
pub unsafe fn unchecked_read_to_pixel_buffer<P>(&self) -> PixelBuffer<P> where P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
let pb = PixelBuffer::new_empty(self.0.get_context(),
rect.width as usize * rect.height as usize);
self.0.main_level().first_layer().into_image(None).unwrap()
.raw_read_to_pixel_buffer(&rect, &pb);
pb
}
#[inline]
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
self.main_level().write(rect, data)
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture2d);
impl<'a> ::std::ops::Deref for SrgbTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let client_format = ClientFormatAny::ClientFormat(client_format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, true).unwrap()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture2dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_texture2d::CompressedSrgbTexture2d;
pub mod compressed_srgb_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbTexture2d(TextureAny);
impl GlObject for CompressedSrgbTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture2d(self.0, Some(self.1))
}
}
impl CompressedSrgbTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbTexture2d> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedSrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32, height: u32,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
Ok(CompressedSrgbTexture2d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressedSrgb, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedSrgbFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressedSrgb);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedSrgbTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32) -> Result<CompressedSrgbTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| CompressedSrgbTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read<T>(&self) -> T where T: Texture2dDataSink<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read() }
}
#[inline]
pub fn read_to_pixel_buffer(&self) -> PixelBuffer<(u8, u8, u8, u8)> {
unsafe { self.unchecked_read_to_pixel_buffer() }
}
#[inline]
pub unsafe fn unchecked_read<T, P>(&self) -> T where T: Texture2dDataSink<P>, P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
self.0.main_level().first_layer().into_image(None).unwrap().raw_read(&rect)
}
#[inline]
pub unsafe fn unchecked_read_to_pixel_buffer<P>(&self) -> PixelBuffer<P> where P: PixelValue {
let rect = Rect { left: 0, bottom: 0, width: self.get_width(),
height: self.get_height().unwrap_or(1) };
let pb = PixelBuffer::new_empty(self.0.get_context(),
rect.width as usize * rect.height as usize);
self.0.main_level().first_layer().into_image(None).unwrap()
.raw_read_to_pixel_buffer(&rect, &pb);
pb
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
self.main_level().write(rect, data)
}
#[inline]
pub fn write_compressed_data(&self, rect: Rect, data: &[u8],
width: u32, height: u32, format: CompressedSrgbFormat)
-> Result<(), ()>
{
self.main_level().write_compressed_data(rect, data, width, height, format)
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture2dMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbTexture2d);
impl<'a> ::std::ops::Deref for CompressedSrgbTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
pub fn write<'a, T>(&self, rect: Rect, data: T) where T: Texture2dDataSource<'a> {
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let client_format = ClientFormatAny::ClientFormat(client_format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, true).unwrap()
}
pub fn write_compressed_data(&self, rect: Rect, data: &[u8],
width: u32, height: u32, format: CompressedSrgbFormat)
-> Result<(), ()>
{
assert_eq!(width, rect.width);
assert_eq!(height, rect.height);
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
self.0.upload_texture(rect.left, rect.bottom, 0, (client_format, data),
width, Some(height), None, false)
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedSrgbFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::integral_texture2d::IntegralTexture2d;
pub mod integral_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture2d(TextureAny);
impl GlObject for IntegralTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2d(self.0, Some(self.1))
}
}
impl IntegralTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture2d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t IntegralTexture2d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl IntegralTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<IntegralTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<IntegralTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedIntFormat, mipmaps: MipmapsOption)
-> Result<IntegralTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedIntFormat>, mipmaps: MipmapsOption)
-> Result<IntegralTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyIntegral);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(IntegralTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<IntegralTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| IntegralTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<IntegralTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| IntegralTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<IntegralTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| IntegralTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture2d);
impl<'a> ::std::ops::Deref for IntegralTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture2dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture2d::UnsignedTexture2d;
pub mod unsigned_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture2d(TextureAny);
impl GlObject for UnsignedTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2d(self.0, Some(self.1))
}
}
impl UnsignedTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture2d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t UnsignedTexture2d {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl UnsignedTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<UnsignedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedUintFormat, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedUintFormat>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyUnsigned);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(UnsignedTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<UnsignedTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| UnsignedTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<UnsignedTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| UnsignedTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<UnsignedTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| UnsignedTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture2d);
impl<'a> ::std::ops::Deref for UnsignedTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture2dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture2d::DepthTexture2d;
pub mod depth_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture2d(TextureAny);
impl GlObject for DepthTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture2d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture2d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2d(self.0, Some(self.1))
}
}
impl DepthTexture2d {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture2d> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for &'t DepthTexture2d {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthFormat, mipmaps: MipmapsOption)
-> Result<DepthTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthFormat>, mipmaps: MipmapsOption)
-> Result<DepthTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepth);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<DepthTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| DepthTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<DepthTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| DepthTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<DepthTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| DepthTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dMipmap> {
self.0.mipmap(level).map(|m| DepthTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture2d);
impl<'a> ::std::ops::Deref for DepthTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture2dMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture2d::StencilTexture2d;
pub mod stencil_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture2d(TextureAny);
impl GlObject for StencilTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for &'t StencilTexture2d {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl StencilTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<StencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<StencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: StencilFormat, mipmaps: MipmapsOption)
-> Result<StencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<StencilFormat>, mipmaps: MipmapsOption)
-> Result<StencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyStencil);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(StencilTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<StencilTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| StencilTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<StencilTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| StencilTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<StencilTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| StencilTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dMipmap> {
self.0.mipmap(level).map(|m| StencilTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture2d);
impl<'a> ::std::ops::Deref for StencilTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture2dMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture2d::DepthStencilTexture2d;
pub mod depth_stencil_texture2d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture2d(TextureAny);
impl GlObject for DepthStencilTexture2d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture2d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture2d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for &'t DepthStencilTexture2d {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthStencilTexture2d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthStencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthStencilFormat, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthStencilFormat>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2d, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepthStencil);
let RawImage2d { data, width, height, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthStencilTexture2d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2d { width: width, height: height }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32)
-> Result<DepthStencilTexture2d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| DepthStencilTexture2d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<DepthStencilTexture2d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height });
t.map(|t| DepthStencilTexture2d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32) -> Result<DepthStencilTexture2d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2d { width: width, height: height }).map(|t| DepthStencilTexture2d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture2d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture2d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture2d);
impl<'a> ::std::ops::Deref for DepthStencilTexture2dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture2dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture2dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture2dMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture2d_multisample::Texture2dMultisample;
pub mod texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture2dMultisample(TextureAny);
impl GlObject for Texture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture2dMultisample {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dMultisample(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture2dMultisample> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dMultisample(self.0, Some(self.1))
}
}
impl Texture2dMultisample {
#[inline]
pub fn sampled(&self) -> Sampler<Texture2dMultisample> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t Texture2dMultisample {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl Texture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<Texture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| Texture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<Texture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| Texture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<Texture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| Texture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| Texture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture2dMultisample);
impl<'a> ::std::ops::Deref for Texture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture2dMultisampleMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::integral_texture2d_multisample::IntegralTexture2dMultisample;
pub mod integral_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture2dMultisample(TextureAny);
impl GlObject for IntegralTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture2dMultisample {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dMultisample(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture2dMultisample> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dMultisample(self.0, Some(self.1))
}
}
impl IntegralTexture2dMultisample {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture2dMultisample> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t IntegralTexture2dMultisample {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl IntegralTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<IntegralTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| IntegralTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<IntegralTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| IntegralTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<IntegralTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| IntegralTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture2dMultisample);
impl<'a> ::std::ops::Deref for IntegralTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::srgb_texture2d_multisample::SrgbTexture2dMultisample;
pub mod srgb_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture2dMultisample(TextureAny);
impl GlObject for SrgbTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture2dMultisample {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dMultisample(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture2dMultisample> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dMultisample(self.0, Some(self.1))
}
}
impl SrgbTexture2dMultisample {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture2dMultisample> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t SrgbTexture2dMultisample {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl SrgbTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<SrgbTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| SrgbTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<SrgbTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| SrgbTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<SrgbTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| SrgbTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture2dMultisample);
impl<'a> ::std::ops::Deref for SrgbTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture2d_multisample::UnsignedTexture2dMultisample;
pub mod unsigned_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture2dMultisample(TextureAny);
impl GlObject for UnsignedTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture2dMultisample {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dMultisample(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture2dMultisample> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dMultisample(self.0, Some(self.1))
}
}
impl UnsignedTexture2dMultisample {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture2dMultisample> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for &'t UnsignedTexture2dMultisample {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl UnsignedTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<UnsignedTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| UnsignedTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<UnsignedTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| UnsignedTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<UnsignedTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| UnsignedTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn as_surface<'a>(&'a self) -> framebuffer::SimpleFrameBuffer<'a> {
framebuffer::SimpleFrameBuffer::new(self.0.get_context(), self).unwrap()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture2dMultisample);
impl<'a> ::std::ops::Deref for UnsignedTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture2d_multisample::DepthTexture2dMultisample;
pub mod depth_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture2dMultisample(TextureAny);
impl GlObject for DepthTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture2dMultisample {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dMultisample(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture2dMultisample> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dMultisample(self.0, Some(self.1))
}
}
impl DepthTexture2dMultisample {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture2dMultisample> {
Sampler(self, Default::default())
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for &'t DepthTexture2dMultisample {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<DepthTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| DepthTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<DepthTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| DepthTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<DepthTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| DepthTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| DepthTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture2dMultisample);
impl<'a> ::std::ops::Deref for DepthTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture2d_multisample::StencilTexture2dMultisample;
pub mod stencil_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture2dMultisample(TextureAny);
impl GlObject for StencilTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for &'t StencilTexture2dMultisample {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl StencilTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<StencilTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| StencilTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<StencilTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| StencilTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<StencilTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| StencilTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| StencilTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture2dMultisample);
impl<'a> ::std::ops::Deref for StencilTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture2d_multisample::DepthStencilTexture2dMultisample;
pub mod depth_stencil_texture2d_multisample {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture2dMultisample(TextureAny);
impl GlObject for DepthStencilTexture2dMultisample {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture2dMultisample {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture2dMultisample {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for &'t DepthStencilTexture2dMultisample {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.0.main_level().first_layer().into_image(None).unwrap())
}
}
impl DepthStencilTexture2dMultisample {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, samples: u32)
-> Result<DepthStencilTexture2dMultisample, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| DepthStencilTexture2dMultisample(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<DepthStencilTexture2dMultisample, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples });
t.map(|t| DepthStencilTexture2dMultisample(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, samples: u32) -> Result<DepthStencilTexture2dMultisample, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisample { width: width, height: height, samples: samples }).map(|t| DepthStencilTexture2dMultisample(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture2dMultisample {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture2dMultisample(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dMultisampleMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dMultisampleMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dMultisampleMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dMultisampleMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture2dMultisample);
impl<'a> ::std::ops::Deref for DepthStencilTexture2dMultisampleMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture2dMultisampleMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2dMultisample {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture2dMultisampleMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture2dMultisampleMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture3d::Texture3d;
pub mod texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture3d(TextureAny);
impl GlObject for Texture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture3d(self.0, Some(self.1))
}
}
impl Texture3d {
#[inline]
pub fn sampled(&self) -> Sampler<Texture3d> {
Sampler(self, Default::default())
}
}
impl Texture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<Texture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
Texture3d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<Texture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
Texture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedFloatFormat, mipmaps: MipmapsOption)
-> Result<Texture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
Texture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedFloatFormat>, mipmaps: MipmapsOption)
-> Result<Texture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyFloatingPoint);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(Texture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<Texture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| Texture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<Texture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| Texture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<Texture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| Texture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture3dMipmap> {
self.0.mipmap(level).map(|m| Texture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture3d);
impl<'a> ::std::ops::Deref for Texture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture3dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_texture3d::CompressedTexture3d;
pub mod compressed_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedTexture3d(TextureAny);
impl GlObject for CompressedTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture3d(self.0, Some(self.1))
}
}
impl CompressedTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedTexture3d> {
Sampler(self, Default::default())
}
}
impl CompressedTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedTexture3d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32, height: u32, depth: u32,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture3d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
Ok(CompressedTexture3d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressed, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressed);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32, depth: u32) -> Result<CompressedTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| CompressedTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture3dMipmap> {
self.0.mipmap(level).map(|m| CompressedTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedTexture3d);
impl<'a> ::std::ops::Deref for CompressedTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::srgb_texture3d::SrgbTexture3d;
pub mod srgb_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture3d(TextureAny);
impl GlObject for SrgbTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture3d(self.0, Some(self.1))
}
}
impl SrgbTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture3d> {
Sampler(self, Default::default())
}
}
impl SrgbTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<SrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
SrgbTexture3d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<SrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
SrgbTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: SrgbFormat, mipmaps: MipmapsOption)
-> Result<SrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
SrgbTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<SrgbFormat>, mipmaps: MipmapsOption)
-> Result<SrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnySrgb);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(SrgbTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<SrgbTexture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| SrgbTexture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<SrgbTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| SrgbTexture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<SrgbTexture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| SrgbTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture3dMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture3d);
impl<'a> ::std::ops::Deref for SrgbTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture3dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_texture3d::CompressedSrgbTexture3d;
pub mod compressed_srgb_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbTexture3d(TextureAny);
impl GlObject for CompressedSrgbTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture3d(self.0, Some(self.1))
}
}
impl CompressedSrgbTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbTexture3d> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<CompressedSrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedSrgbTexture3d::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedSrgbTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: &[u8], width: u32, height: u32, depth: u32,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture3d, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
Ok(CompressedSrgbTexture3d(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressedSrgb, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
CompressedSrgbTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<CompressedSrgbFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressedSrgb);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedSrgbTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32, depth: u32) -> Result<CompressedSrgbTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| CompressedSrgbTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture3dMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbTexture3d);
impl<'a> ::std::ops::Deref for CompressedSrgbTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedSrgbFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
}
pub use self::integral_texture3d::IntegralTexture3d;
pub mod integral_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture3d(TextureAny);
impl GlObject for IntegralTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture3d(self.0, Some(self.1))
}
}
impl IntegralTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture3d> {
Sampler(self, Default::default())
}
}
impl IntegralTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<IntegralTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
IntegralTexture3d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<IntegralTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
IntegralTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedIntFormat, mipmaps: MipmapsOption)
-> Result<IntegralTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
IntegralTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedIntFormat>, mipmaps: MipmapsOption)
-> Result<IntegralTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyIntegral);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(IntegralTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<IntegralTexture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| IntegralTexture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<IntegralTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| IntegralTexture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<IntegralTexture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| IntegralTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture3dMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture3d);
impl<'a> ::std::ops::Deref for IntegralTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture3dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture3d::UnsignedTexture3d;
pub mod unsigned_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture3d(TextureAny);
impl GlObject for UnsignedTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture3d(self.0, Some(self.1))
}
}
impl UnsignedTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture3d> {
Sampler(self, Default::default())
}
}
impl UnsignedTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<UnsignedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
UnsignedTexture3d::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<UnsignedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
UnsignedTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: UncompressedUintFormat, mipmaps: MipmapsOption)
-> Result<UnsignedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
UnsignedTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<UncompressedUintFormat>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyUnsigned);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(UnsignedTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<UnsignedTexture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| UnsignedTexture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<UnsignedTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| UnsignedTexture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<UnsignedTexture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| UnsignedTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture3dMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture3d);
impl<'a> ::std::ops::Deref for UnsignedTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture3dMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture3d::DepthTexture3d;
pub mod depth_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture3d(TextureAny);
impl GlObject for DepthTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture3d {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture3d(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture3d> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture3d(self.0, Some(self.1))
}
}
impl DepthTexture3d {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture3d> {
Sampler(self, Default::default())
}
}
impl DepthTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthTexture3d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthFormat, mipmaps: MipmapsOption)
-> Result<DepthTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthFormat>, mipmaps: MipmapsOption)
-> Result<DepthTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepth);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<DepthTexture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| DepthTexture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<DepthTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| DepthTexture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<DepthTexture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| DepthTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture3dMipmap> {
self.0.mipmap(level).map(|m| DepthTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture3d);
impl<'a> ::std::ops::Deref for DepthTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture3dMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture3d::DepthStencilTexture3d;
pub mod depth_stencil_texture3d {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture3d(TextureAny);
impl GlObject for DepthStencilTexture3d {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture3d {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture3d {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilTexture3d {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: T)
-> Result<DepthStencilTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthStencilTexture3d::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: T, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthStencilTexture3d::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: T,
format: DepthStencilFormat, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
DepthStencilTexture3d::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: T,
format: Option<DepthStencilFormat>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture3d, TextureCreationError>
where T: Texture3dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepthStencil);
let RawImage3d { data, width, height, depth, format: client_format } =
data.into_raw();
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthStencilTexture3d(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, depth: u32)
-> Result<DepthStencilTexture3d, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| DepthStencilTexture3d(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<DepthStencilTexture3d, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth });
t.map(|t| DepthStencilTexture3d(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, depth: u32) -> Result<DepthStencilTexture3d, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture3d { width: width, height: height, depth: depth }).map(|t| DepthStencilTexture3d(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture3d {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture3d(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture3dMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture3dMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture3dMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture3dMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture3d);
impl<'a> ::std::ops::Deref for DepthStencilTexture3dMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture3dMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn depth(&self) -> u32 {
self.0.get_depth().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32, u32) {
(self.width(), self.height(), self.depth())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture3d {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture3dMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.first_layer().into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture3dMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture1d_array::Texture1dArray;
pub mod texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture1dArray(TextureAny);
impl GlObject for Texture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture1dArray(self.0, Some(self.1))
}
}
impl Texture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<Texture1dArray> {
Sampler(self, Default::default())
}
}
impl Texture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<Texture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<Texture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedFloatFormat, mipmaps: MipmapsOption)
-> Result<Texture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
Texture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedFloatFormat>, mipmaps: MipmapsOption)
-> Result<Texture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyFloatingPoint);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(Texture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<Texture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| Texture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<Texture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| Texture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<Texture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| Texture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> Texture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture1dArrayLayer> {
self.0.layer(layer).map(|l| Texture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture1dArrayMipmap> {
self.0.mipmap(level).map(|m| Texture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t Texture1dArray);
impl<'t> Texture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t Texture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| Texture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> Texture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture1dArray);
impl<'a> ::std::ops::Deref for Texture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t Texture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> Texture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| Texture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct Texture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t Texture1dArray);
impl<'t> Texture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture1dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_texture1d_array::CompressedTexture1dArray;
pub mod compressed_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedTexture1dArray(TextureAny);
impl GlObject for CompressedTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture1dArray(self.0, Some(self.1))
}
}
impl CompressedTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedTexture1dArray> {
Sampler(self, Default::default())
}
}
impl CompressedTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<CompressedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1dArray::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: Vec<&[u8]>, width: u32, array_size: u32,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1dArray, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
Ok(CompressedTexture1dArray(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressed, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<CompressedFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressed);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, width: u32, array_size: u32) -> Result<CompressedTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| CompressedTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedTexture1dArrayLayer> {
self.0.layer(layer).map(|l| CompressedTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedTexture1dArray);
impl<'t> CompressedTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedTexture1dArray);
impl<'a> ::std::ops::Deref for CompressedTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedTexture1dArray);
impl<'t> CompressedTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
}
pub use self::srgb_texture1d_array::SrgbTexture1dArray;
pub mod srgb_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture1dArray(TextureAny);
impl GlObject for SrgbTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture1dArray(self.0, Some(self.1))
}
}
impl SrgbTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture1dArray> {
Sampler(self, Default::default())
}
}
impl SrgbTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<SrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<SrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: SrgbFormat, mipmaps: MipmapsOption)
-> Result<SrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
SrgbTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<SrgbFormat>, mipmaps: MipmapsOption)
-> Result<SrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnySrgb);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(SrgbTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<SrgbTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| SrgbTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<SrgbTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| SrgbTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<SrgbTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| SrgbTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture1dArrayLayer> {
self.0.layer(layer).map(|l| SrgbTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t SrgbTexture1dArray);
impl<'t> SrgbTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| SrgbTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture1dArray);
impl<'a> ::std::ops::Deref for SrgbTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| SrgbTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t SrgbTexture1dArray);
impl<'t> SrgbTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_texture1d_array::CompressedSrgbTexture1dArray;
pub mod compressed_srgb_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbTexture1dArray(TextureAny);
impl GlObject for CompressedSrgbTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture1dArray(self.0, Some(self.1))
}
}
impl CompressedSrgbTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbTexture1dArray> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<CompressedSrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1dArray::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: Vec<&[u8]>, width: u32, array_size: u32,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1dArray, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
Ok(CompressedSrgbTexture1dArray(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressedSrgb, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
CompressedSrgbTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<CompressedSrgbFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressedSrgb);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedSrgbTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, width: u32, array_size: u32) -> Result<CompressedSrgbTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| CompressedSrgbTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbTexture1dArrayLayer> {
self.0.layer(layer).map(|l| CompressedSrgbTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedSrgbTexture1dArray);
impl<'t> CompressedSrgbTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbTexture1dArray);
impl<'a> ::std::ops::Deref for CompressedSrgbTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedSrgbTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedSrgbTexture1dArray);
impl<'t> CompressedSrgbTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
}
pub use self::integral_texture1d_array::IntegralTexture1dArray;
pub mod integral_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture1dArray(TextureAny);
impl GlObject for IntegralTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture1dArray(self.0, Some(self.1))
}
}
impl IntegralTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture1dArray> {
Sampler(self, Default::default())
}
}
impl IntegralTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<IntegralTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1dArray::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<IntegralTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedIntFormat, mipmaps: MipmapsOption)
-> Result<IntegralTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
IntegralTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedIntFormat>, mipmaps: MipmapsOption)
-> Result<IntegralTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyIntegral);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(IntegralTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<IntegralTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| IntegralTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<IntegralTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| IntegralTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<IntegralTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| IntegralTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture1dArrayLayer> {
self.0.layer(layer).map(|l| IntegralTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t IntegralTexture1dArray);
impl<'t> IntegralTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| IntegralTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture1dArray);
impl<'a> ::std::ops::Deref for IntegralTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| IntegralTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t IntegralTexture1dArray);
impl<'t> IntegralTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture1d_array::UnsignedTexture1dArray;
pub mod unsigned_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture1dArray(TextureAny);
impl GlObject for UnsignedTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture1dArray(self.0, Some(self.1))
}
}
impl UnsignedTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture1dArray> {
Sampler(self, Default::default())
}
}
impl UnsignedTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<UnsignedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1dArray::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedUintFormat, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
UnsignedTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedUintFormat>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyUnsigned);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(UnsignedTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<UnsignedTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| UnsignedTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<UnsignedTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| UnsignedTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<UnsignedTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| UnsignedTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture1dArrayLayer> {
self.0.layer(layer).map(|l| UnsignedTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t UnsignedTexture1dArray);
impl<'t> UnsignedTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| UnsignedTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture1dArray);
impl<'a> ::std::ops::Deref for UnsignedTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| UnsignedTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t UnsignedTexture1dArray);
impl<'t> UnsignedTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture1d_array::DepthTexture1dArray;
pub mod depth_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture1dArray(TextureAny);
impl GlObject for DepthTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture1dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture1dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture1dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture1dArray(self.0, Some(self.1))
}
}
impl DepthTexture1dArray {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture1dArray> {
Sampler(self, Default::default())
}
}
impl DepthTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<DepthTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<DepthTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: DepthFormat, mipmaps: MipmapsOption)
-> Result<DepthTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<DepthFormat>, mipmaps: MipmapsOption)
-> Result<DepthTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepth);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<DepthTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| DepthTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<DepthTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| DepthTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<DepthTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| DepthTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture1dArrayLayer> {
self.0.layer(layer).map(|l| DepthTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| DepthTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthTexture1dArray);
impl<'t> DepthTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture1dArray);
impl<'a> ::std::ops::Deref for DepthTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthTexture1dArray);
impl<'t> DepthTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture1d_array::StencilTexture1dArray;
pub mod stencil_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture1dArray(TextureAny);
impl GlObject for StencilTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl StencilTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<StencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<StencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: StencilFormat, mipmaps: MipmapsOption)
-> Result<StencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
StencilTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<StencilFormat>, mipmaps: MipmapsOption)
-> Result<StencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyStencil);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(StencilTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<StencilTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| StencilTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<StencilTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| StencilTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<StencilTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| StencilTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> StencilTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture1dArrayLayer> {
self.0.layer(layer).map(|l| StencilTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| StencilTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t StencilTexture1dArray);
impl<'t> StencilTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| StencilTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> StencilTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture1dArray);
impl<'a> ::std::ops::Deref for StencilTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> StencilTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| StencilTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t StencilTexture1dArray);
impl<'t> StencilTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture1d_array::DepthStencilTexture1dArray;
pub mod depth_stencil_texture1d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture1dArray(TextureAny);
impl GlObject for DepthStencilTexture1dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture1dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture1dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilTexture1dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<DepthStencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: DepthStencilFormat, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
DepthStencilTexture1dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<DepthStencilFormat>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture1dArray, TextureCreationError>
where T: Texture1dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepthStencil);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage2d {data, width, height: array_size, format: client_format } = RawImage2d::from_vec_raw1d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthStencilTexture1dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, array_size: u32)
-> Result<DepthStencilTexture1dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| DepthStencilTexture1dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<DepthStencilTexture1dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size });
t.map(|t| DepthStencilTexture1dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, array_size: u32) -> Result<DepthStencilTexture1dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture1dArray { width: width, array_size: array_size }).map(|t| DepthStencilTexture1dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture1dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture1dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture1dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture1dArrayLayer> {
self.0.layer(layer).map(|l| DepthStencilTexture1dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture1dArrayMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture1dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture1dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture1dArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthStencilTexture1dArray);
impl<'t> DepthStencilTexture1dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture1dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture1dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthStencilTexture1dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture1dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture1dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture1dArray);
impl<'a> ::std::ops::Deref for DepthStencilTexture1dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture1dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture1dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture1dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture1dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthStencilTexture1dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture1dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthStencilTexture1dArray);
impl<'t> DepthStencilTexture1dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture1dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture1dArrayLayerMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture2d_array::Texture2dArray;
pub mod texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture2dArray(TextureAny);
impl GlObject for Texture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dArray(self.0, Some(self.1))
}
}
impl Texture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<Texture2dArray> {
Sampler(self, Default::default())
}
}
impl Texture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<Texture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<Texture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedFloatFormat, mipmaps: MipmapsOption)
-> Result<Texture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
Texture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedFloatFormat>, mipmaps: MipmapsOption)
-> Result<Texture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyFloatingPoint);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(Texture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<Texture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| Texture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<Texture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| Texture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<Texture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| Texture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> Texture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture2dArrayLayer> {
self.0.layer(layer).map(|l| Texture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dArrayMipmap> {
self.0.mipmap(level).map(|m| Texture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t Texture2dArray);
impl<'t> Texture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| Texture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> Texture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture2dArray);
impl<'a> ::std::ops::Deref for Texture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> Texture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| Texture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct Texture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t Texture2dArray);
impl<'t> Texture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture2dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_texture2d_array::CompressedTexture2dArray;
pub mod compressed_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedTexture2dArray(TextureAny);
impl GlObject for CompressedTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedTexture2dArray(self.0, Some(self.1))
}
}
impl CompressedTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedTexture2dArray> {
Sampler(self, Default::default())
}
}
impl CompressedTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<CompressedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2dArray::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: Vec<&[u8]>, width: u32, height: u32, array_size: u32,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2dArray, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedFormat(format);
Ok(CompressedTexture2dArray(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressed, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: CompressedFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<CompressedFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressed);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32, array_size: u32) -> Result<CompressedTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| CompressedTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedTexture2dArrayLayer> {
self.0.layer(layer).map(|l| CompressedTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedTexture2dArray);
impl<'t> CompressedTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedTexture2dArray);
impl<'a> ::std::ops::Deref for CompressedTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedTexture2dArray);
impl<'t> CompressedTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
}
pub use self::srgb_texture2d_array::SrgbTexture2dArray;
pub mod srgb_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture2dArray(TextureAny);
impl GlObject for SrgbTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dArray(self.0, Some(self.1))
}
}
impl SrgbTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture2dArray> {
Sampler(self, Default::default())
}
}
impl SrgbTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<SrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<SrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: SrgbFormat, mipmaps: MipmapsOption)
-> Result<SrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
SrgbTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<SrgbFormat>, mipmaps: MipmapsOption)
-> Result<SrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnySrgb);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(SrgbTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<SrgbTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| SrgbTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<SrgbTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| SrgbTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<SrgbTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| SrgbTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture2dArrayLayer> {
self.0.layer(layer).map(|l| SrgbTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t SrgbTexture2dArray);
impl<'t> SrgbTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| SrgbTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture2dArray);
impl<'a> ::std::ops::Deref for SrgbTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| SrgbTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t SrgbTexture2dArray);
impl<'t> SrgbTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_texture2d_array::CompressedSrgbTexture2dArray;
pub mod compressed_srgb_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbTexture2dArray(TextureAny);
impl GlObject for CompressedSrgbTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbTexture2dArray(self.0, Some(self.1))
}
}
impl CompressedSrgbTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbTexture2dArray> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<CompressedSrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2dArray::new_impl(facade, data, None, CompressedMipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_compressed_data<F: ?Sized>(facade: &F, data: Vec<&[u8]>, width: u32, height: u32, array_size: u32,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2dArray, TextureCreationError>
where F: Facade
{
let data = Cow::Borrowed(data.as_ref());
let client_format = ClientFormatAny::CompressedSrgbFormat(format);
Ok(CompressedSrgbTexture2dArray(try!(any::new_texture(facade, TextureFormatRequest::AnyCompressedSrgb, Some((client_format, data)),
mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
CompressedSrgbTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<CompressedSrgbFormat>, mipmaps: CompressedMipmapsOption)
-> Result<CompressedSrgbTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyCompressedSrgb);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(CompressedSrgbTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, width: u32, height: u32, array_size: u32) -> Result<CompressedSrgbTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| CompressedSrgbTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbTexture2dArrayLayer> {
self.0.layer(layer).map(|l| CompressedSrgbTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedSrgbTexture2dArray);
impl<'t> CompressedSrgbTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedSrgbTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbTexture2dArray);
impl<'a> ::std::ops::Deref for CompressedSrgbTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedSrgbTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedSrgbTexture2dArray);
impl<'t> CompressedSrgbTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
}
pub use self::integral_texture2d_array::IntegralTexture2dArray;
pub mod integral_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture2dArray(TextureAny);
impl GlObject for IntegralTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dArray(self.0, Some(self.1))
}
}
impl IntegralTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture2dArray> {
Sampler(self, Default::default())
}
}
impl IntegralTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<IntegralTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2dArray::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<IntegralTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedIntFormat, mipmaps: MipmapsOption)
-> Result<IntegralTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
IntegralTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedIntFormat>, mipmaps: MipmapsOption)
-> Result<IntegralTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyIntegral);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(IntegralTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<IntegralTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| IntegralTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<IntegralTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| IntegralTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<IntegralTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| IntegralTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture2dArrayLayer> {
self.0.layer(layer).map(|l| IntegralTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t IntegralTexture2dArray);
impl<'t> IntegralTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| IntegralTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture2dArray);
impl<'a> ::std::ops::Deref for IntegralTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| IntegralTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t IntegralTexture2dArray);
impl<'t> IntegralTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture2d_array::UnsignedTexture2dArray;
pub mod unsigned_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture2dArray(TextureAny);
impl GlObject for UnsignedTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dArray(self.0, Some(self.1))
}
}
impl UnsignedTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture2dArray> {
Sampler(self, Default::default())
}
}
impl UnsignedTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<UnsignedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2dArray::new_impl(facade, data, None, MipmapsOption::NoMipmap)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: UncompressedUintFormat, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
UnsignedTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<UncompressedUintFormat>, mipmaps: MipmapsOption)
-> Result<UnsignedTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyUnsigned);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(UnsignedTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<UnsignedTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| UnsignedTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<UnsignedTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| UnsignedTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<UnsignedTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| UnsignedTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture2dArrayLayer> {
self.0.layer(layer).map(|l| UnsignedTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t UnsignedTexture2dArray);
impl<'t> UnsignedTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| UnsignedTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture2dArray);
impl<'a> ::std::ops::Deref for UnsignedTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| UnsignedTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t UnsignedTexture2dArray);
impl<'t> UnsignedTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture2d_array::DepthTexture2dArray;
pub mod depth_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture2dArray(TextureAny);
impl GlObject for DepthTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture2dArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture2dArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dArray(self.0, Some(self.1))
}
}
impl DepthTexture2dArray {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture2dArray> {
Sampler(self, Default::default())
}
}
impl DepthTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<DepthTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<DepthTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: DepthFormat, mipmaps: MipmapsOption)
-> Result<DepthTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<DepthFormat>, mipmaps: MipmapsOption)
-> Result<DepthTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepth);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<DepthTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| DepthTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<DepthTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| DepthTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<DepthTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| DepthTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture2dArrayLayer> {
self.0.layer(layer).map(|l| DepthTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| DepthTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthTexture2dArray);
impl<'t> DepthTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture2dArray);
impl<'a> ::std::ops::Deref for DepthTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthTexture2dArray);
impl<'t> DepthTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture2d_array::StencilTexture2dArray;
pub mod stencil_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture2dArray(TextureAny);
impl GlObject for StencilTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl StencilTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<StencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<StencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: StencilFormat, mipmaps: MipmapsOption)
-> Result<StencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
StencilTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<StencilFormat>, mipmaps: MipmapsOption)
-> Result<StencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyStencil);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(StencilTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<StencilTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| StencilTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<StencilTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| StencilTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<StencilTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| StencilTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> StencilTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture2dArrayLayer> {
self.0.layer(layer).map(|l| StencilTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| StencilTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t StencilTexture2dArray);
impl<'t> StencilTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| StencilTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture2dArray);
impl<'a> ::std::ops::Deref for StencilTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> StencilTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| StencilTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t StencilTexture2dArray);
impl<'t> StencilTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture2d_array::DepthStencilTexture2dArray;
pub mod depth_stencil_texture2d_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture2dArray(TextureAny);
impl GlObject for DepthStencilTexture2dArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture2dArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture2dArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilTexture2dArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn new<'a, F: ?Sized, T>(facade: &F, data: Vec<T>)
-> Result<DepthStencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2dArray::new_impl(facade, data, None, MipmapsOption::AutoGeneratedMipmaps)
}
#[inline]
pub fn with_mipmaps<'a, F: ?Sized, T>(facade: &F, data: Vec<T>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2dArray::new_impl(facade, data, None, mipmaps)
}
#[inline]
pub fn with_format<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: DepthStencilFormat, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
DepthStencilTexture2dArray::new_impl(facade, data, Some(format), mipmaps)
}
#[inline]
fn new_impl<'a, F: ?Sized, T>(facade: &F, data: Vec<T>,
format: Option<DepthStencilFormat>, mipmaps: MipmapsOption)
-> Result<DepthStencilTexture2dArray, TextureCreationError>
where T: Texture2dDataSource<'a>, F: Facade
{
let format = format.map(|f| {
TextureFormatRequest::Specific(f.to_texture_format())
}).unwrap_or(TextureFormatRequest::AnyDepthStencil);
let vec_raw = data.into_iter().map(|e| e.into_raw()).collect();
let RawImage3d {data, width, height, depth: array_size, format: client_format } = RawImage3d::from_vec_raw2d(&vec_raw);
let client_format = ClientFormatAny::ClientFormat(client_format);Ok(DepthStencilTexture2dArray(try!(any::new_texture(facade, format, Some((client_format, data)), mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }))))
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32)
-> Result<DepthStencilTexture2dArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| DepthStencilTexture2dArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<DepthStencilTexture2dArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size });
t.map(|t| DepthStencilTexture2dArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32) -> Result<DepthStencilTexture2dArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dArray { width: width, height: height, array_size: array_size }).map(|t| DepthStencilTexture2dArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture2dArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture2dArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture2dArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture2dArrayLayer> {
self.0.layer(layer).map(|l| DepthStencilTexture2dArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dArrayMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthStencilTexture2dArray);
impl<'t> DepthStencilTexture2dArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2dArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture2dArray);
impl<'a> ::std::ops::Deref for DepthStencilTexture2dArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture2dArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2dArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture2dArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture2dArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthStencilTexture2dArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthStencilTexture2dArray);
impl<'t> DepthStencilTexture2dArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture2dArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture2dArrayLayerMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::texture2d_multisample_array::Texture2dMultisampleArray;
pub mod texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Texture2dMultisampleArray(TextureAny);
impl GlObject for Texture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Texture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Texture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Texture2dMultisampleArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dMultisampleArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Texture2dMultisampleArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Texture2dMultisampleArray(self.0, Some(self.1))
}
}
impl Texture2dMultisampleArray {
#[inline]
pub fn sampled(&self) -> Sampler<Texture2dMultisampleArray> {
Sampler(self, Default::default())
}
}
impl Texture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<Texture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| Texture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<Texture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| Texture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<Texture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| Texture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Texture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Texture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> Texture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| Texture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| Texture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> Texture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t Texture2dMultisampleArray);
impl<'t> Texture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<Texture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| Texture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> Texture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct Texture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t Texture2dMultisampleArray);
impl<'a> ::std::ops::Deref for Texture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> Texture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t Texture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> Texture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<Texture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| Texture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct Texture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t Texture2dMultisampleArray);
impl<'t> Texture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for Texture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for Texture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::srgb_texture2d_multisample_array::SrgbTexture2dMultisampleArray;
pub mod srgb_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbTexture2dMultisampleArray(TextureAny);
impl GlObject for SrgbTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbTexture2dMultisampleArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dMultisampleArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbTexture2dMultisampleArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbTexture2dMultisampleArray(self.0, Some(self.1))
}
}
impl SrgbTexture2dMultisampleArray {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbTexture2dMultisampleArray> {
Sampler(self, Default::default())
}
}
impl SrgbTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<SrgbTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| SrgbTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<SrgbTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| SrgbTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<SrgbTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| SrgbTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| SrgbTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| SrgbTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t SrgbTexture2dMultisampleArray);
impl<'t> SrgbTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| SrgbTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> SrgbTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for SrgbTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> SrgbTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| SrgbTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct SrgbTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t SrgbTexture2dMultisampleArray);
impl<'t> SrgbTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::integral_texture2d_multisample_array::IntegralTexture2dMultisampleArray;
pub mod integral_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralTexture2dMultisampleArray(TextureAny);
impl GlObject for IntegralTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralTexture2dMultisampleArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dMultisampleArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralTexture2dMultisampleArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralTexture2dMultisampleArray(self.0, Some(self.1))
}
}
impl IntegralTexture2dMultisampleArray {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralTexture2dMultisampleArray> {
Sampler(self, Default::default())
}
}
impl IntegralTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<IntegralTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| IntegralTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<IntegralTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| IntegralTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<IntegralTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| IntegralTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| IntegralTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| IntegralTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t IntegralTexture2dMultisampleArray);
impl<'t> IntegralTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| IntegralTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> IntegralTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for IntegralTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> IntegralTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| IntegralTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct IntegralTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t IntegralTexture2dMultisampleArray);
impl<'t> IntegralTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_texture2d_multisample_array::UnsignedTexture2dMultisampleArray;
pub mod unsigned_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedTexture2dMultisampleArray(TextureAny);
impl GlObject for UnsignedTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedTexture2dMultisampleArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dMultisampleArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedTexture2dMultisampleArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedTexture2dMultisampleArray(self.0, Some(self.1))
}
}
impl UnsignedTexture2dMultisampleArray {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedTexture2dMultisampleArray> {
Sampler(self, Default::default())
}
}
impl UnsignedTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<UnsignedTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| UnsignedTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<UnsignedTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| UnsignedTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<UnsignedTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| UnsignedTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| UnsignedTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| UnsignedTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t UnsignedTexture2dMultisampleArray);
impl<'t> UnsignedTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| UnsignedTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> UnsignedTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for UnsignedTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> UnsignedTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| UnsignedTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct UnsignedTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t UnsignedTexture2dMultisampleArray);
impl<'t> UnsignedTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_texture2d_multisample_array::DepthTexture2dMultisampleArray;
pub mod depth_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthTexture2dMultisampleArray(TextureAny);
impl GlObject for DepthTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthTexture2dMultisampleArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dMultisampleArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthTexture2dMultisampleArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthTexture2dMultisampleArray(self.0, Some(self.1))
}
}
impl DepthTexture2dMultisampleArray {
#[inline]
pub fn sampled(&self) -> Sampler<DepthTexture2dMultisampleArray> {
Sampler(self, Default::default())
}
}
impl DepthTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<DepthTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| DepthTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<DepthTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| DepthTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<DepthTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| DepthTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| DepthTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| DepthTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthTexture2dMultisampleArray);
impl<'t> DepthTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for DepthTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthTexture2dMultisampleArray);
impl<'t> DepthTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_texture2d_multisample_array::StencilTexture2dMultisampleArray;
pub mod stencil_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilTexture2dMultisampleArray(TextureAny);
impl GlObject for StencilTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl StencilTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<StencilTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| StencilTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<StencilTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| StencilTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<StencilTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| StencilTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> StencilTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| StencilTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| StencilTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t StencilTexture2dMultisampleArray);
impl<'t> StencilTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| StencilTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> StencilTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for StencilTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t StencilTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> StencilTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| StencilTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct StencilTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t StencilTexture2dMultisampleArray);
impl<'t> StencilTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_texture2d_multisample_array::DepthStencilTexture2dMultisampleArray;
pub mod depth_stencil_texture2d_multisample_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilTexture2dMultisampleArray(TextureAny);
impl GlObject for DepthStencilTexture2dMultisampleArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilTexture2dMultisampleArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilTexture2dMultisampleArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilTexture2dMultisampleArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, width: u32, height: u32, array_size: u32, samples: u32)
-> Result<DepthStencilTexture2dMultisampleArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| DepthStencilTexture2dMultisampleArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<DepthStencilTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples });
t.map(|t| DepthStencilTexture2dMultisampleArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, width: u32, height: u32, array_size: u32, samples: u32) -> Result<DepthStencilTexture2dMultisampleArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Texture2dMultisampleArray { width: width, height: height, array_size: array_size, samples: samples }).map(|t| DepthStencilTexture2dMultisampleArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilTexture2dMultisampleArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilTexture2dMultisampleArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture2dMultisampleArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture2dMultisampleArrayLayer> {
self.0.layer(layer).map(|l| DepthStencilTexture2dMultisampleArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dMultisampleArrayMipmap> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dMultisampleArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dMultisampleArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dMultisampleArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthStencilTexture2dMultisampleArray);
impl<'t> DepthStencilTexture2dMultisampleArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
(self.1).0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2dMultisampleArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthStencilTexture2dMultisampleArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthStencilTexture2dMultisampleArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dMultisampleArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilTexture2dMultisampleArray);
impl<'a> ::std::ops::Deref for DepthStencilTexture2dMultisampleArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilTexture2dMultisampleArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilTexture2dMultisampleArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthStencilTexture2dMultisampleArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilTexture2dMultisampleArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthStencilTexture2dMultisampleArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilTexture2dMultisampleArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthStencilTexture2dMultisampleArray);
impl<'t> DepthStencilTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn samples(&self) -> u32 {
self.0.get_samples().unwrap()
}
#[inline]
pub fn dimensions(&self) -> (u32, u32) {
(self.width(), self.height())
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilTexture2dMultisampleArrayLayerMipmap<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0.into_image(None).unwrap()
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilTexture2dMultisampleArrayLayerMipmap<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::cubemap::Cubemap;
pub mod cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct Cubemap(TextureAny);
impl GlObject for Cubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for Cubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for Cubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a Cubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Cubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, Cubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::Cubemap(self.0, Some(self.1))
}
}
impl Cubemap {
#[inline]
pub fn sampled(&self) -> Sampler<Cubemap> {
Sampler(self, Default::default())
}
}
impl Cubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<Cubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| Cubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<Cubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| Cubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<Cubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| Cubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> Cubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
Cubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CubemapMipmap> {
self.0.mipmap(level).map(|m| CubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t Cubemap);
impl<'a> ::std::ops::Deref for CubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t Cubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> CubemapImage<'t> {
CubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CubemapImage<'t>(TextureAnyImage<'t>, &'t Cubemap);
impl<'t> CubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for CubemapImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_cubemap::CompressedCubemap;
pub mod compressed_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedCubemap(TextureAny);
impl GlObject for CompressedCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedCubemap(self.0, Some(self.1))
}
}
impl CompressedCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedCubemap> {
Sampler(self, Default::default())
}
}
impl CompressedCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, dimension: u32) -> Result<CompressedCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| CompressedCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedCubemapMipmap> {
self.0.mipmap(level).map(|m| CompressedCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedCubemap);
impl<'a> ::std::ops::Deref for CompressedCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> CompressedCubemapImage<'t> {
CompressedCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapImage<'t>(TextureAnyImage<'t>, &'t CompressedCubemap);
impl<'t> CompressedCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
}
pub use self::srgb_cubemap::SrgbCubemap;
pub mod srgb_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbCubemap(TextureAny);
impl GlObject for SrgbCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbCubemap(self.0, Some(self.1))
}
}
impl SrgbCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbCubemap> {
Sampler(self, Default::default())
}
}
impl SrgbCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<SrgbCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| SrgbCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<SrgbCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| SrgbCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<SrgbCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| SrgbCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbCubemapMipmap> {
self.0.mipmap(level).map(|m| SrgbCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbCubemap);
impl<'a> ::std::ops::Deref for SrgbCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> SrgbCubemapImage<'t> {
SrgbCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapImage<'t>(TextureAnyImage<'t>, &'t SrgbCubemap);
impl<'t> SrgbCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbCubemapImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_cubemap::CompressedSrgbCubemap;
pub mod compressed_srgb_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbCubemap(TextureAny);
impl GlObject for CompressedSrgbCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbCubemap(self.0, Some(self.1))
}
}
impl CompressedSrgbCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbCubemap> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, dimension: u32) -> Result<CompressedSrgbCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| CompressedSrgbCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
self.main_level().read_compressed_data()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbCubemapMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbCubemap);
impl<'a> ::std::ops::Deref for CompressedSrgbCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn read_compressed_data(&self) -> Option<(CompressedSrgbFormat, Vec<u8>)> {
match self.0.download_compressed_data() {
Some((ClientFormatAny::CompressedSrgbFormat(format), buf)) => Some((format, buf)),
None => None,
_ => unreachable!(),
}
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> CompressedSrgbCubemapImage<'t> {
CompressedSrgbCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapImage<'t>(TextureAnyImage<'t>, &'t CompressedSrgbCubemap);
impl<'t> CompressedSrgbCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
}
pub use self::integral_cubemap::IntegralCubemap;
pub mod integral_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralCubemap(TextureAny);
impl GlObject for IntegralCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralCubemap(self.0, Some(self.1))
}
}
impl IntegralCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralCubemap> {
Sampler(self, Default::default())
}
}
impl IntegralCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<IntegralCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| IntegralCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<IntegralCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| IntegralCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<IntegralCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| IntegralCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralCubemapMipmap> {
self.0.mipmap(level).map(|m| IntegralCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralCubemap);
impl<'a> ::std::ops::Deref for IntegralCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> IntegralCubemapImage<'t> {
IntegralCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapImage<'t>(TextureAnyImage<'t>, &'t IntegralCubemap);
impl<'t> IntegralCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralCubemapImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_cubemap::UnsignedCubemap;
pub mod unsigned_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedCubemap(TextureAny);
impl GlObject for UnsignedCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedCubemap(self.0, Some(self.1))
}
}
impl UnsignedCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedCubemap> {
Sampler(self, Default::default())
}
}
impl UnsignedCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<UnsignedCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| UnsignedCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<UnsignedCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| UnsignedCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<UnsignedCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| UnsignedCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedCubemapMipmap> {
self.0.mipmap(level).map(|m| UnsignedCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedCubemap);
impl<'a> ::std::ops::Deref for UnsignedCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> UnsignedCubemapImage<'t> {
UnsignedCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapImage<'t>(TextureAnyImage<'t>, &'t UnsignedCubemap);
impl<'t> UnsignedCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedCubemapImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_cubemap::DepthCubemap;
pub mod depth_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthCubemap(TextureAny);
impl GlObject for DepthCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthCubemap {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthCubemap(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthCubemap> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthCubemap(self.0, Some(self.1))
}
}
impl DepthCubemap {
#[inline]
pub fn sampled(&self) -> Sampler<DepthCubemap> {
Sampler(self, Default::default())
}
}
impl DepthCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<DepthCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| DepthCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<DepthCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| DepthCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<DepthCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| DepthCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthCubemapMipmap> {
self.0.mipmap(level).map(|m| DepthCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthCubemap);
impl<'a> ::std::ops::Deref for DepthCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> DepthCubemapImage<'t> {
DepthCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapImage<'t>(TextureAnyImage<'t>, &'t DepthCubemap);
impl<'t> DepthCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthCubemapImage<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_cubemap::StencilCubemap;
pub mod stencil_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilCubemap(TextureAny);
impl GlObject for StencilCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl StencilCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<StencilCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| StencilCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<StencilCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| StencilCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<StencilCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| StencilCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilCubemapMipmap> {
self.0.mipmap(level).map(|m| StencilCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilCubemap);
impl<'a> ::std::ops::Deref for StencilCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> StencilCubemapImage<'t> {
StencilCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapImage<'t>(TextureAnyImage<'t>, &'t StencilCubemap);
impl<'t> StencilCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilCubemapImage<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_cubemap::DepthStencilCubemap;
pub mod depth_stencil_cubemap {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilCubemap(TextureAny);
impl GlObject for DepthStencilCubemap {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilCubemap {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilCubemap {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilCubemap {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32)
-> Result<DepthStencilCubemap, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| DepthStencilCubemap(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, dimension: u32) -> Result<DepthStencilCubemap, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension });
t.map(|t| DepthStencilCubemap(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32) -> Result<DepthStencilCubemap, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::Cubemap { dimension: dimension }).map(|t| DepthStencilCubemap(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilCubemap {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilCubemap(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilCubemapMipmap> {
self.0.mipmap(level).map(|m| DepthStencilCubemapMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilCubemapMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilCubemap);
impl<'a> ::std::ops::Deref for DepthStencilCubemapMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilCubemapMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilCubemap {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
pub fn image(&self, layer: CubeLayer) -> DepthStencilCubemapImage<'t> {
DepthStencilCubemapImage(self.0.first_layer().into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapImage<'t>(TextureAnyImage<'t>, &'t DepthStencilCubemap);
impl<'t> DepthStencilCubemapImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilCubemapImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilCubemapImage<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}
pub use self::cubemap_array::CubemapArray;
pub mod cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CubemapArray(TextureAny);
impl GlObject for CubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CubemapArray(self.0, Some(self.1))
}
}
impl CubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<CubemapArray> {
Sampler(self, Default::default())
}
}
impl CubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<CubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| CubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedFloatFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<CubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| CubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<CubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyFloatingPoint;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| CubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedFloatFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CubemapArrayLayer> {
self.0.layer(layer).map(|l| CubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CubemapArrayMipmap> {
self.0.mipmap(level).map(|m| CubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t CubemapArray);
impl<'t> CubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CubemapArray);
impl<'a> ::std::ops::Deref for CubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CubemapArray);
impl<'t> CubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> CubemapArrayImage<'t> {
CubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CubemapArrayImage<'t>(TextureAnyImage<'t>, &'t CubemapArray);
impl<'t> CubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for CubemapArrayImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_cubemap_array::CompressedCubemapArray;
pub mod compressed_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedCubemapArray(TextureAny);
impl GlObject for CompressedCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedCubemapArray(self.0, Some(self.1))
}
}
impl CompressedCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedCubemapArray> {
Sampler(self, Default::default())
}
}
impl CompressedCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedFormat, mipmaps: CompressedMipmapsOption, dimension: u32, array_size: u32) -> Result<CompressedCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| CompressedCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedCubemapArrayLayer> {
self.0.layer(layer).map(|l| CompressedCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedCubemapArray);
impl<'t> CompressedCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedCubemapArray);
impl<'a> ::std::ops::Deref for CompressedCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedCubemapArray);
impl<'t> CompressedCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> CompressedCubemapArrayImage<'t> {
CompressedCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CompressedCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t CompressedCubemapArray);
impl<'t> CompressedCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
}
pub use self::srgb_cubemap_array::SrgbCubemapArray;
pub mod srgb_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct SrgbCubemapArray(TextureAny);
impl GlObject for SrgbCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for SrgbCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for SrgbCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a SrgbCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, SrgbCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::SrgbCubemapArray(self.0, Some(self.1))
}
}
impl SrgbCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<SrgbCubemapArray> {
Sampler(self, Default::default())
}
}
impl SrgbCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<SrgbCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| SrgbCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: SrgbFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<SrgbCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| SrgbCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<SrgbCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnySrgb;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| SrgbCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: SrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> SrgbCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
SrgbCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> SrgbCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbCubemapArrayLayer> {
self.0.layer(layer).map(|l| SrgbCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| SrgbCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> SrgbCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t SrgbCubemapArray);
impl<'t> SrgbCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<SrgbCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| SrgbCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> SrgbCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t SrgbCubemapArray);
impl<'a> ::std::ops::Deref for SrgbCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> SrgbCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t SrgbCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> SrgbCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<SrgbCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| SrgbCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t SrgbCubemapArray);
impl<'t> SrgbCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> SrgbCubemapArrayImage<'t> {
SrgbCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct SrgbCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t SrgbCubemapArray);
impl<'t> SrgbCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for SrgbCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for SrgbCubemapArrayImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::compressed_srgb_cubemap_array::CompressedSrgbCubemapArray;
pub mod compressed_srgb_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct CompressedSrgbCubemapArray(TextureAny);
impl GlObject for CompressedSrgbCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for CompressedSrgbCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for CompressedSrgbCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a CompressedSrgbCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, CompressedSrgbCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::CompressedSrgbCubemapArray(self.0, Some(self.1))
}
}
impl CompressedSrgbCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<CompressedSrgbCubemapArray> {
Sampler(self, Default::default())
}
}
impl CompressedSrgbCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: CompressedSrgbFormat, mipmaps: CompressedMipmapsOption, dimension: u32, array_size: u32) -> Result<CompressedSrgbCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| CompressedSrgbCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: CompressedSrgbFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> CompressedSrgbCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
CompressedSrgbCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbCubemapArrayLayer> {
self.0.layer(layer).map(|l| CompressedSrgbCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| CompressedSrgbCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t CompressedSrgbCubemapArray);
impl<'t> CompressedSrgbCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<CompressedSrgbCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| CompressedSrgbCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> CompressedSrgbCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t CompressedSrgbCubemapArray);
impl<'a> ::std::ops::Deref for CompressedSrgbCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> CompressedSrgbCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t CompressedSrgbCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> CompressedSrgbCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<CompressedSrgbCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| CompressedSrgbCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t CompressedSrgbCubemapArray);
impl<'t> CompressedSrgbCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> CompressedSrgbCubemapArrayImage<'t> {
CompressedSrgbCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct CompressedSrgbCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t CompressedSrgbCubemapArray);
impl<'t> CompressedSrgbCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for CompressedSrgbCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
}
pub use self::integral_cubemap_array::IntegralCubemapArray;
pub mod integral_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct IntegralCubemapArray(TextureAny);
impl GlObject for IntegralCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for IntegralCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for IntegralCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a IntegralCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, IntegralCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::IntegralCubemapArray(self.0, Some(self.1))
}
}
impl IntegralCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<IntegralCubemapArray> {
Sampler(self, Default::default())
}
}
impl IntegralCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<IntegralCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| IntegralCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedIntFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<IntegralCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| IntegralCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<IntegralCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyIntegral;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| IntegralCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedIntFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> IntegralCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
IntegralCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> IntegralCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralCubemapArrayLayer> {
self.0.layer(layer).map(|l| IntegralCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| IntegralCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> IntegralCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t IntegralCubemapArray);
impl<'t> IntegralCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<IntegralCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| IntegralCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> IntegralCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t IntegralCubemapArray);
impl<'a> ::std::ops::Deref for IntegralCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> IntegralCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t IntegralCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> IntegralCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<IntegralCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| IntegralCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t IntegralCubemapArray);
impl<'t> IntegralCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> IntegralCubemapArrayImage<'t> {
IntegralCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct IntegralCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t IntegralCubemapArray);
impl<'t> IntegralCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for IntegralCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for IntegralCubemapArrayImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::unsigned_cubemap_array::UnsignedCubemapArray;
pub mod unsigned_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct UnsignedCubemapArray(TextureAny);
impl GlObject for UnsignedCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for UnsignedCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for UnsignedCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a UnsignedCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, UnsignedCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::UnsignedCubemapArray(self.0, Some(self.1))
}
}
impl UnsignedCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<UnsignedCubemapArray> {
Sampler(self, Default::default())
}
}
impl UnsignedCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<UnsignedCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| UnsignedCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: UncompressedUintFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<UnsignedCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| UnsignedCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<UnsignedCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyUnsigned;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| UnsignedCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: UncompressedUintFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> UnsignedCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
UnsignedCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> UnsignedCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedCubemapArrayLayer> {
self.0.layer(layer).map(|l| UnsignedCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| UnsignedCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> UnsignedCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t UnsignedCubemapArray);
impl<'t> UnsignedCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<UnsignedCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| UnsignedCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> UnsignedCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t UnsignedCubemapArray);
impl<'a> ::std::ops::Deref for UnsignedCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> UnsignedCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t UnsignedCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> UnsignedCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<UnsignedCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| UnsignedCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t UnsignedCubemapArray);
impl<'t> UnsignedCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> UnsignedCubemapArrayImage<'t> {
UnsignedCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct UnsignedCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t UnsignedCubemapArray);
impl<'t> UnsignedCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for UnsignedCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToColorAttachment<'t> for UnsignedCubemapArrayImage<'t> {
#[inline]
fn to_color_attachment(self) -> ::framebuffer::ColorAttachment<'t> {
::framebuffer::ColorAttachment::Texture(self.into())
}
}
}
pub use self::depth_cubemap_array::DepthCubemapArray;
pub mod depth_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthCubemapArray(TextureAny);
impl GlObject for DepthCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl<'a> AsUniformValue for &'a DepthCubemapArray {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthCubemapArray(*self, None)
}
}
impl<'a> AsUniformValue for Sampler<'a, DepthCubemapArray> {
#[inline]
fn as_uniform_value(&self) -> UniformValue {
UniformValue::DepthCubemapArray(self.0, Some(self.1))
}
}
impl DepthCubemapArray {
#[inline]
pub fn sampled(&self) -> Sampler<DepthCubemapArray> {
Sampler(self, Default::default())
}
}
impl DepthCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<DepthCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| DepthCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<DepthCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| DepthCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<DepthCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepth;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| DepthCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthCubemapArrayLayer> {
self.0.layer(layer).map(|l| DepthCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| DepthCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthCubemapArray);
impl<'t> DepthCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthCubemapArray);
impl<'a> ::std::ops::Deref for DepthCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthCubemapArray);
impl<'t> DepthCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> DepthCubemapArrayImage<'t> {
DepthCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct DepthCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t DepthCubemapArray);
impl<'t> DepthCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToDepthAttachment<'t> for DepthCubemapArrayImage<'t> {
#[inline]
fn to_depth_attachment(self) -> ::framebuffer::DepthAttachment<'t> {
::framebuffer::DepthAttachment::Texture(self.into())
}
}
}
pub use self::stencil_cubemap_array::StencilCubemapArray;
pub mod stencil_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct StencilCubemapArray(TextureAny);
impl GlObject for StencilCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for StencilCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for StencilCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl StencilCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<StencilCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| StencilCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: StencilFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<StencilCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| StencilCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<StencilCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| StencilCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: StencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> StencilCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
StencilCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> StencilCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilCubemapArrayLayer> {
self.0.layer(layer).map(|l| StencilCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| StencilCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> StencilCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t StencilCubemapArray);
impl<'t> StencilCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<StencilCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| StencilCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> StencilCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t StencilCubemapArray);
impl<'a> ::std::ops::Deref for StencilCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> StencilCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t StencilCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> StencilCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<StencilCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| StencilCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t StencilCubemapArray);
impl<'t> StencilCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> StencilCubemapArrayImage<'t> {
StencilCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct StencilCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t StencilCubemapArray);
impl<'t> StencilCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for StencilCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToStencilAttachment<'t> for StencilCubemapArrayImage<'t> {
#[inline]
fn to_stencil_attachment(self) -> ::framebuffer::StencilAttachment<'t> {
::framebuffer::StencilAttachment::Texture(self.into())
}
}
}
pub use self::depth_stencil_cubemap_array::DepthStencilCubemapArray;
pub mod depth_stencil_cubemap_array {
#![allow(unused_imports)]
use std::borrow::Cow;
use texture::any::{self, TextureAny, TextureAnyLayer, TextureAnyMipmap};
use texture::any::{TextureAnyLayerMipmap, TextureAnyImage, Dimensions};
use texture::bindless::{ResidentTexture, BindlessTexturesNotSupportedError};
use texture::get_format::{InternalFormat, InternalFormatType, GetFormatError};
use texture::pixel_buffer::PixelBuffer;
use texture::{TextureCreationError, Texture1dDataSource, Texture2dDataSource};
use texture::{Texture3dDataSource, Texture2dDataSink, MipmapsOption, CompressedMipmapsOption};
use texture::{RawImage1d, RawImage2d, RawImage3d, CubeLayer};
use texture::pixel::PixelValue;
use image_format::{ClientFormatAny, TextureFormatRequest};
use image_format::{UncompressedFloatFormat, UncompressedIntFormat};
use image_format::{CompressedFormat, DepthFormat, DepthStencilFormat, StencilFormat};
use image_format::{CompressedSrgbFormat, SrgbFormat, UncompressedUintFormat};
use backend::Facade;
use uniforms::{UniformValue, AsUniformValue, Sampler};
use framebuffer;
use Rect;
use GlObject;
use TextureExt;
use TextureMipmapExt;
use gl;
pub struct DepthStencilCubemapArray(TextureAny);
impl GlObject for DepthStencilCubemapArray {
type Id = gl::types::GLuint;
#[inline]
fn get_id(&self) -> gl::types::GLuint {
self.0.get_id()
}
}
impl ::std::fmt::Debug for DepthStencilCubemapArray {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>
{
self.0.fmt(f)
}
}
impl ::std::ops::Deref for DepthStencilCubemapArray {
type Target = TextureAny;
#[inline]
fn deref<'a>(&'a self) -> &'a TextureAny {
&self.0
}
}
impl DepthStencilCubemapArray {
#[inline]
pub fn get_internal_format(&self) -> Result<InternalFormat, GetFormatError> {
self.0.get_internal_format()
}
#[inline]
pub fn empty<F: ?Sized>(facade: &F, dimension: u32, array_size: u32)
-> Result<DepthStencilCubemapArray, TextureCreationError>
where F: Facade
{
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, MipmapsOption::NoMipmap.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| DepthStencilCubemapArray(t))}
#[inline]
pub fn empty_with_format<F: ?Sized>(facade: &F, format: DepthStencilFormat, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<DepthStencilCubemapArray, TextureCreationError> where F: Facade {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
let t = any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size });
t.map(|t| DepthStencilCubemapArray(t))
}
#[inline]
pub fn empty_with_mipmaps<F: ?Sized>(facade: &F, mipmaps: MipmapsOption, dimension: u32, array_size: u32) -> Result<DepthStencilCubemapArray, TextureCreationError> where F: Facade {
let format = TextureFormatRequest::AnyDepthStencil;
any::new_texture::<_, u8>(facade, format, None, mipmaps.into(), Dimensions::CubemapArray { dimension: dimension, array_size: array_size }).map(|t| DepthStencilCubemapArray(t))
}
pub unsafe fn from_id<F: Facade + ?Sized>(facade: &F,
format: DepthStencilFormat,
id: gl::types::GLuint,
owned: bool,
mipmap: MipmapsOption,
ty: Dimensions)
-> DepthStencilCubemapArray {
let format = format.to_texture_format();
let format = TextureFormatRequest::Specific(format);
DepthStencilCubemapArray(any::from_id(facade, format, id, owned, mipmap, ty))
}
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_mipmap_levels()
}
#[inline]
pub fn resident(self) -> Result<ResidentTexture, BindlessTexturesNotSupportedError> {
ResidentTexture::new(self.0)
}
#[inline]
pub fn first_layer(&self) -> DepthStencilCubemapArrayLayer {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilCubemapArrayLayer> {
self.0.layer(layer).map(|l| DepthStencilCubemapArrayLayer(l, self))
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilCubemapArrayMipmap> {
self.0.mipmap(level).map(|m| DepthStencilCubemapArrayMipmap(m, self))
}
#[inline]
pub fn main_level(&self) -> DepthStencilCubemapArrayMipmap {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapArrayLayer<'t>(TextureAnyLayer<'t>, &'t DepthStencilCubemapArray);
impl<'t> DepthStencilCubemapArrayLayer<'t> {
#[inline]
pub fn width(&self) -> u32 {
(self.1).0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
(self.1).0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilCubemapArray {
&self.1
}
#[inline]
pub fn get_layer(&self) -> u32 {
self.0.get_layer()
}
#[inline]
pub fn get_mipmap_levels(&self) -> u32 {
self.0.get_texture().get_mipmap_levels()
}
#[inline]
pub fn mipmap(&self, level: u32) -> Option<DepthStencilCubemapArrayLayerMipmap<'t>> {
self.0.mipmap(level).map(|m| DepthStencilCubemapArrayLayerMipmap(m, self.1))
}
#[inline]
pub fn main_level(&self) -> DepthStencilCubemapArrayLayerMipmap<'t> {
self.mipmap(0).unwrap()
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapArrayMipmap<'t>(TextureAnyMipmap<'t>, &'t DepthStencilCubemapArray);
impl<'a> ::std::ops::Deref for DepthStencilCubemapArrayMipmap<'a> {
type Target = TextureAnyMipmap<'a>;
#[inline]
fn deref(&self) -> &TextureAnyMipmap<'a> {
&self.0
}
}
impl<'t> DepthStencilCubemapArrayMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn array_size(&self) -> u32 {
self.0.get_array_size().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
#[inline]
pub fn get_texture(&self) -> &'t DepthStencilCubemapArray {
self.1
}
#[inline]
pub fn get_level(&self) -> u32 {
self.0.get_level()
}
#[inline]
pub fn first_layer(&self) -> DepthStencilCubemapArrayLayerMipmap<'t> {
self.layer(0).unwrap()
}
#[inline]
pub fn layer(&self, layer: u32) -> Option<DepthStencilCubemapArrayLayerMipmap<'t>> {
self.0.layer(layer).map(|l| DepthStencilCubemapArrayLayerMipmap(l, self.1))
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapArrayLayerMipmap<'t>(TextureAnyLayerMipmap<'t>, &'t DepthStencilCubemapArray);
impl<'t> DepthStencilCubemapArrayLayerMipmap<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
pub fn image(&self, layer: CubeLayer) -> DepthStencilCubemapArrayImage<'t> {
DepthStencilCubemapArrayImage(self.0.into_image(Some(layer)).unwrap(), self.1)
}
}
#[derive(Copy, Clone)]
pub struct DepthStencilCubemapArrayImage<'t>(TextureAnyImage<'t>, &'t DepthStencilCubemapArray);
impl<'t> DepthStencilCubemapArrayImage<'t> {
#[inline]
pub fn width(&self) -> u32 {
self.0.get_width()
}
#[inline]
pub fn height(&self) -> u32 {
self.0.get_height().unwrap()
}
#[inline]
pub fn dimensions(&self) -> u32 {
self.width()
}
}
impl<'t> Into<TextureAnyImage<'t>> for DepthStencilCubemapArrayImage<'t> {
fn into(self) -> TextureAnyImage<'t> {
self.0
}
}
impl<'t> ::framebuffer::ToDepthStencilAttachment<'t> for DepthStencilCubemapArrayImage<'t> {
#[inline]
fn to_depth_stencil_attachment(self) -> ::framebuffer::DepthStencilAttachment<'t> {
::framebuffer::DepthStencilAttachment::Texture(self.into())
}
}
}